package com.zy.openchat.core.model.circle;

import android.os.Parcel;
import android.os.Parcelable;

import com.google.gson.annotations.SerializedName;
import com.zy.openchat.core.model.photo.PhotoInfo;
import com.zy.openchat.core.model.video.VideoInfo;

import java.util.List;

public class BlogContentInfo implements Parcelable {

    @SerializedName(value = "@type")
    public String type;
    public List<PhotoInfo> photos;
    public VideoInfo video;
    public VideoInfo animation;

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.type);
        dest.writeTypedList(this.photos);
        dest.writeParcelable(this.video, flags);
    }

    public void readFromParcel(Parcel source) {
        this.type = source.readString();
        this.photos = source.createTypedArrayList(PhotoInfo.CREATOR);
        this.video = source.readParcelable(VideoInfo.class.getClassLoader());
    }

    public BlogContentInfo() {
    }

    protected BlogContentInfo(Parcel in) {
        this.type = in.readString();
        this.photos = in.createTypedArrayList(PhotoInfo.CREATOR);
        this.video = in.readParcelable(VideoInfo.class.getClassLoader());
    }

    public static final Creator<BlogContentInfo> CREATOR = new Creator<BlogContentInfo>() {
        @Override
        public BlogContentInfo createFromParcel(Parcel source) {
            return new BlogContentInfo(source);
        }

        @Override
        public BlogContentInfo[] newArray(int size) {
            return new BlogContentInfo[size];
        }
    };
}
